package org.example.result;


public class R {
    private Integer code;
    private String msg;
    private Object data;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public R() {

    }

    public R(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public R(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static R ok() {
        return new R(1, "success");
    }

    public static R ok(Object data) {
        return new R(1, "success", data);
    }
    public static R error(String msg) {
        return new R(0, msg);
    }

    public static R error() {
        return new R(0, "error");
    }

    public static R error(String msg,Object data) {
        return new R(0,msg, data);
    }
}
